package com.wuze.cloud.pojo;

import com.wuze.cloud.enums.SysStateEnum;
import com.wuze.cloud.util.SnowFlakeIdWorker;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author: wuze
 * @description:
 * @date: 2023/02/16
 */
@Data
public class SysFolderDO implements Serializable {
    private static final long serialVersionUID = 1249939615359279254L;

    private Long id;
    private Long pid;
    private Long userId;
    private String folderName;
    private String state;
    private Date createTime;
    private Date updateTime;

    public static SysFolderDO createRoot(Long userId) {
        SysFolderDO folderDO = new SysFolderDO();
        folderDO.setId(SnowFlakeIdWorker.nextId());
        folderDO.setPid(-1L);
        folderDO.setFolderName("root");
        folderDO.setUserId(userId);
        folderDO.setState(SysStateEnum.CREATE.name());
        return folderDO;
    }

    public static SysFolderDO createRoot() {
        SysFolderDO folderDO = new SysFolderDO();
        folderDO.setId(SnowFlakeIdWorker.nextId());
        folderDO.setPid(-1L);
        folderDO.setFolderName("/");
        folderDO.setUserId(SnowFlakeIdWorker.nextId());
        folderDO.setState(SysStateEnum.CREATE.name());
        return folderDO;
    }
}
